﻿Type.registerNamespace("VisualCron");

VisualCron.Connections = function () {

    VisualCron.Connections.initializeBase(this);

    // fields
    this._connections = [];

}

VisualCron.Connections.prototype = {

    // properties
    get_connections: function () {
        return this._connections;
    },

    set_connections: function (val) {
        this._connections = val;
    },

    // methods
    getConnectionById: function (connectionId) {
        var recordId = this.get_connections().findSingle(function (toTest) { return toTest.ConnectionId == connectionId; });

        if (recordId != -1) {
            return this.get_connections()[recordId];
        }

    },

    getConnectionByUserServerId: function (userServerId) {
        var recordId = this.get_connections().findSingle(function (toTest) { return toTest.UserServerId == userServerId; });

        if (recordId != -1) {
            return this.get_connections()[recordId];
        }

    }

}
VisualCron.Connections.registerClass('VisualCron.Connections', Sys.Component);

// Since this script is not loaded by System.Web.Handlers.ScriptResourceHandler
// invoke Sys.Application.notifyScriptLoaded to notify ScriptManager
// that this is the end of the script.
if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();